home *** CD-ROM | disk | FTP | other *** search
- property softwareTitle, srcPath, fileList, destPath, copiedFiles
-
- on new me
- me.softwareTitle = "Aberrator 3.0"
- me.srcPath = the moviePath
- me.fileList = ["aberrator30.exe"]
- if the platform contains "mac" then
- me.destPath = baSysFolder("apps") & me.softwareTitle & ":"
- else
- me.destPath = baSysFolder("program files") & me.softwareTitle & "\"
- end if
- me.copiedFiles = []
- return me
- end
-
- on confirmInstall me
- muiStatLi = [#S1: "This program will install the selected software on your computer"]
- if softwareTitle <> EMPTY then
- muiStatLi[#S1] = "This program will install" && softwareTitle && "on your computer"
- end if
- muiResult = confirmInstallDialog(VOID, VOID, VOID, VOID, muiStatLi, VOID, VOID, VOID, VOID)
- if muiResult[2] = "cancel" then
- exitInstaller()
- end if
- end
-
- on setDestPath me, startPath
- if (startPath = VOID) or (startPath = EMPTY) then
- if the platform contains "mac" then
- startPath = baSysFolder("apps") & me.softwareTitle & ":"
- else
- startPath = baSysFolder("program files") & me.softwareTitle & "\"
- end if
- end if
- muiResult = installationPathDialog(VOID, VOID, VOID, VOID, VOID, [#installationPathField: startPath], VOID, VOID, VOID)
- case muiResult[2] of
- "cancel":
- exitInstaller()
- "browse":
- newPath = baGetFolder(me.destPath, "Select installation folder", 2, EMPTY, -1, -1)
- setDestPath(me, newPath)
- "OK":
- newPath = muiResult[3][#installationPathField]
- if validatePath(me, newPath) then
- me.destPath = newPath
- else
- baMsgBox("Illegal path entered", "Error", "OK", "exclamation", 1)
- setDestPath(me, newPath)
- end if
- end case
- end
-
- on performInstall me
- me.copiedFiles = []
- if not baFolderExists(me.destPath) then
- baCreateFolder(me.destPath)
- end if
- if me.fileList.count > 0 then
- repeat with i = 1 to me.fileList.count
- copyResult = baCopyFile(me.srcPath & me.fileList[i], me.destPath & me.fileList[i], "always")
- if copyResult = 0 then
- copiedFiles.add(me.fileList[i])
- end if
- end repeat
- end if
- if me.copiedFiles.count <> me.fileList.count then
- baMsgBox("Some files could not be copied to the specified folder. Please try again", "Error", "OK", "exclamation", 1)
- exitInstaller()
- end if
- end
-
- on validatePath me, aPath
- lastDelim = the itemDelimiter
- if the platform contains "mac" then
- the itemDelimiter = ":"
- else
- the itemDelimiter = "\"
- end if
- theResult = 1
- if aPath = EMPTY then
- theResult = 0
- end if
- if baDiskList().getOne(aPath.item[1] & the itemDelimiter) = 0 then
- theResult = 0
- end if
- case baDiskInfo(aPath.item[1], "type") of
- "CD-ROM", "floppy", "RAM", "invalid":
- theResult = 0
- end case
- the itemDelimiter = lastDelim
- return theResult
- end
-
- on addShortcut me
- muiResult = addShortcutDialog()
- if muiResult[2] = "yes" then
- baMakeShortcut(me.destPath & me.fileList[1], baSysFolder("desktop"), me.softwareTitle)
- end if
- end
-
- on addUninstallInfo me
- uninstallText = "To uninstall this software simply delete this folder"
- baWriteFile(me.destPath & "uninstall info.txt", uninstallText, EMPTY)
- end
-